package berkekeydb;

import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

import billing.system.http.HttpUtils;
import billing.system.logger.SysLog;

public class T2 implements Callable<String>{
	private String url ;
	
	public T2(String url) {
		this.url = url;
	}
	@Override
	public String call() throws Exception {
		return HttpUtils.get(url);
	}

	public static void main(String[] args) throws InterruptedException, ExecutionException {
		ExecutorService es = Executors.newFixedThreadPool(2); 
		Set<Future<String>> result = new HashSet<Future<String>>();
		
		for (int i = 0; i < 3; i++) {
			Future<String> future = es.submit(new T2("http://v.qq.com"));
			result.add(future);
		}
		int id = 0;
		for (Future<String> future : result) {
			SysLog.o("page["+(id++)+"].html", future.get(),true);
		}
		es.shutdown();
	}
	
}
